package com.edu.exam.enums.assessment.plan;

/**
 * 审核状态枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum AuditStatus {
    DRAFT("DRAFT", "草稿"),
    PENDING("PENDING", "待审核"),
    IN_PROGRESS("IN_PROGRESS", "审核中"),
    APPROVED("APPROVED", "已通过"),
    REJECTED("REJECTED", "已拒绝"),
    CANCELLED("CANCELLED", "已取消"),
    SUSPENDED("SUSPENDED", "已暂停"),
    REVISION_REQUIRED("REVISION_REQUIRED", "需修改"),
    RESUBMIT("RESUBMIT", "重新提交"),
    COMPLETED("COMPLETED", "已完成"),
    EXPIRED("EXPIRED", "已过期");

    private final String code;
    private final String description;

    AuditStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AuditStatus fromCode(String code) {
        for (AuditStatus status : AuditStatus.values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown audit status code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}
